package com.cloud.screen.interfaces;


import com.cloud.screen.common.config.FeignConfiguration;
import com.cloud.screen.common.result.SelectItem;
import feign.hystrix.FallbackFactory;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.cloud.netflix.feign.FeignClient;
import org.springframework.stereotype.Component;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RequestParam;

import java.util.List;
import java.util.Map;

@FeignClient(value = "SYSTEM",  configuration = FeignConfiguration.class, fallbackFactory = FeignClientSystemFallbackFactory.class)
public interface FeignClientSystem {
    /**
     * 部门级别统计
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getUnitLevelStat", method = RequestMethod.GET)
    List<Map<String, Object>> getUnitLevelStat(@RequestParam("isSupervise") Integer isSupervise,@RequestParam("unitID")Long unitID);

    /**
     * 监督部门级别统计
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getSupUnitLevelStat", method = RequestMethod.GET)
    List<Map<String, Object>> getSupUnitLevelStat(@RequestParam("unitID")Long unitID);

    /**
     * 内设监督机构级别统计
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getInnerSupUnitLevelStat", method = RequestMethod.GET)
    List<Map<String, Object>> getInnerSupUnitLevelStat(@RequestParam("unitID")Long unitID);

    /**
     * 部门性质统计
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getUnitNatureStat", method = RequestMethod.GET)
    List<Map<String, Object>> getUnitNatureStat(@RequestParam("isSupervise") Integer isSupervise,@RequestParam("unitID")Long unitID);

    /**
     * 部门区域统计
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getUnitAreaStat", method = RequestMethod.GET)
    List<Map<String, Object>> getUnitAreaStat(@RequestParam("isSupervise") Integer isSupervise);

    /**
     * 主体类别统计
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getLawSubjectStat", method = RequestMethod.GET)
    List<Map<String, Object>> getLawSubjectStat(@RequestParam("unitID")Long unitID);

    /**
     * 委托机构方式统计
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getEntrustUnitStat", method = RequestMethod.GET)
    List<Map<String, Object>> getEntrustUnitStat();

    /**
     * 委托机构性质统计
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getEntrustNatureStat", method = RequestMethod.GET)
    List<Map<String, Object>> getEntrustNatureStat();


    /**
     * 执法人员学历统计
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getPatrolEduStat", method = RequestMethod.GET)
    List<Map<String, Object>> getPatrolEduStat(@RequestParam("isSupervise") Integer isSupervise);

    /**
     * 执法人员性质统计
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getPatrolNatureStat", method = RequestMethod.GET)
    List<Map<String, Object>> getPatrolNatureStat();

    /**
     * 执法类型统计
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getPatrolLawTypeStat", method = RequestMethod.GET)
    List<Map<String, Object>> getPatrolLawTypeStat();

    /**
     * 执法队员性别统计
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getPatrolGenderStat", method = RequestMethod.GET)
    List<Map<String, Object>> getPatrolGenderStat(@RequestParam("isSupervise") Integer isSupervise);

    /**
     * 执法队员区域统计
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getPatrolAreaStat", method = RequestMethod.GET)
    List<Map<String, Object>> getPatrolAreaStat(@RequestParam("isSupervise") Integer isSupervise);

    /**
     * 执法证统计
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getPatrolCardStat", method = RequestMethod.GET)
    List<Map<String, Object>> getPatrolCardStat();


    /**
     * 是否拥有执法证统计
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getLawyerStat", method = RequestMethod.GET)
    List<Map<String, Object>> getLawyerStat();


    /**
     * 是否公职律师统计
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getObtainLawCardStat", method = RequestMethod.GET)
    List<Map<String, Object>> getObtainLawCardStat();


    /**
     * 部门区域统计-大屏
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getUnitAreaStatForScreen", method = RequestMethod.GET)
    Map<String, Object> getUnitAreaStatForScreen(@RequestParam("isSupervise") Integer isSupervise,@RequestParam("regionid") Long regionid);

    /**
     * 执法队员区域统计-大屏
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getPatrolAreaStatForScreen", method = RequestMethod.GET)
    Map<String, Object> getPatrolAreaStatForScreen(@RequestParam("isSupervise") Integer isSupervise,@RequestParam("regionid") Long regionid);

    /**
     * 获取机构执法领域信息
     *
     * @return
     */
    @RequestMapping(value = "system/interface/domains/load", method = RequestMethod.GET)
    List<SelectItem> loadDomains(@RequestParam("unitId") Long unitId);

    /**
     * 获取所有省市级
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getUnitInfoForProvince", method = RequestMethod.GET)
    List<Map<String, Object>> getUnitInfoForProvince(@RequestParam("unitId") Long unitId);

    /**
     * 获取所有区域职权法律法规code码
     *
     * @return
     */
    @RequestMapping(value = "system/interface/getUnitPowerListForLawCode", method = RequestMethod.GET)
    List<Map<String, Object>> getUnitPowerListForLawCode(@RequestParam("unitCode") String unitCode,@RequestParam("regionid") Long regionid);


    @RequestMapping(value = "system/interface/getsystemUrl", method = RequestMethod.GET)
    String getSystemUrl();
}

@Component
class FeignClientSystemFallbackFactory implements FallbackFactory<FeignClientSystem> {
    private static final Logger LOGGER = LoggerFactory.getLogger(FeignClientSystemFallbackFactory.class);

    @Override
    public FeignClientSystem create(final Throwable cause) {
        return new FeignClientSystem() {

            @Override
            public List<Map<String, Object>> getUnitLevelStat(Integer isSupervise,Long unitID) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getSupUnitLevelStat(Long unitID) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getInnerSupUnitLevelStat(Long unitID) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getUnitNatureStat(Integer isSupervise,Long unitID) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getUnitAreaStat(Integer isSupervise) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getLawSubjectStat(Long unitID) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getEntrustUnitStat() {
                return null;
            }

            @Override
            public List<Map<String, Object>> getEntrustNatureStat() {
                return null;
            }

            @Override
            public List<Map<String, Object>> getPatrolEduStat(Integer isSupervise) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getPatrolNatureStat() {
                return null;
            }

            @Override
            public List<Map<String, Object>> getPatrolLawTypeStat() {
                return null;
            }

            @Override
            public List<Map<String, Object>> getPatrolGenderStat(Integer isSupervise) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getPatrolAreaStat(Integer isSupervise) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getPatrolCardStat() {
                return null;
            }

            @Override
            public List<Map<String, Object>> getLawyerStat() {
                return null;
            }

            @Override
            public List<Map<String, Object>> getObtainLawCardStat() {
                return null;
            }

            @Override
            public Map<String, Object> getUnitAreaStatForScreen(Integer isSupervise,Long seniorId) {
                return null;
            }

            @Override
            public Map<String, Object> getPatrolAreaStatForScreen(Integer isSupervise,Long regionid) {
                return null;
            }

            @Override
            public List<SelectItem> loadDomains(Long unitId) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getUnitInfoForProvince(Long unitId) {
                return null;
            }

            @Override
            public List<Map<String, Object>> getUnitPowerListForLawCode(String unitCode,Long regionid) {
                return null;
            }

            @Override
            public String getSystemUrl(){
                return null;
            }
        };
    }

}
